#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

int start_dev (char *name)
{
	int i;
	char str [255];
	
	sprintf (str, "/dev/%s", name);
	for (i=0; i< 50; i++) {		
		if (access (str, F_OK) == -1) {
			if (i == 0) system (name);
			usleep (10000);
		} else break;
	}	
	return i;
}

int main (int argc, char *argv[]) 
{
	printf ("qserve starting .. %d ms\n", 10 * start_dev ("qserve"));
	printf ("nserve starting .. %d ms\n", 10 * start_dev ("nserve"));

	system ("datahub");
	//system ("histdb");

	return EXIT_SUCCESS;
}